package src.cl.movix.repositories;

import java.util.ArrayList;

import cl.movix.model.customer.ICustomer;

public interface Repository {

	/**
	 * This method is responsible to insert a user into this repository.
	 * 
	 * @param user
	 *            The user to be inserted.
	 * @return The time elapsed for the transaction to happen.
	 * @throws RepositoryException
	 *             Thrown whenever something wrong happens in the repository
	 *             during the insertion.
	 */
	public long insert(ICustomer user) throws RepositoryException;

	/**
	 * This method is responsible to query the repository about the users with a
	 * given Last name.
	 * 
	 * @param lastName
	 *            The user last name.
	 * @param userResult
	 *            An array where the users with the given last name are put
	 *            into.
	 * @return The time, in milliseconds, that took to query and retrieve the
	 *         users from the repository.
	 * @throws RepositoryException
	 *             Thrown whenever something wrong happens in the repository
	 *             during the query.
	 */
	public long findUsers(String lastName, ArrayList<ICustomer> userResult)
			throws RepositoryException;

	/**
	 * This method is responsible to update a property's user and give back the
	 * time taken for that operation.
	 * 
	 * @param customer
	 *            The user whose property is to be updated.
	 * @param value
	 *            The new value for the property's user.
	 * @return The time taken for the operation.
	 * @throws RepositoryException
	 *             Thrown whenever something wrong happens in the repository
	 *             during the update.
	 */
	public long updateUserProperty(ICustomer customer, String value)
			throws RepositoryException;

	/**
	 * This method is responsible for deleting the records of the usuarios
	 * table.
	 * 
	 * @return The time elapsed for the operation to complete.
	 * @throws RepositoryException
	 *             Thrown if the something happens.
	 */
	public long deleteUsuarios() throws RepositoryException;

	/**
	 * This method is responsible of counting the users in the repository.
	 * 
	 * @throws RepositoryException
	 *             Thrown if the something happens.
	 */
	public long countUsers() throws RepositoryException;

	/**
	 * This method is responsible of counting a given table in the repository.
	 * 
	 * @throws RepositoryException
	 *             Thrown if the something happens.
	 */
	public long countTable(String string)  throws RepositoryException;
}
